package com.koron.common.web.transmit.controller;

import com.koron.bean.app.AppBean;
import com.koron.bean.base.Response;
import com.koron.bean.system.staff.vo.EamUser;
import com.koron.common.core.annocation.CasUser;
import com.koron.common.core.config.ThreadLocalContext;
import com.koron.common.core.util.message.MessageUtil;
import com.koron.common.web.transmit.bean.TransmitBean;
import com.koron.common.web.transmit.service.transmitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.koron.ebs.mybatis.ADOConnection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

@Slf4j
@RestController
@RequestMapping("/transmit")
@Api(tags = "传阅功能")
public class TransmitController {

    @Autowired
    transmitService service;
    MessageUtil messageUtil;

    @PostMapping("/transmit")
    @ApiOperation(value = "点击转发")
    public Response addfollow(@CasUser @ApiIgnore EamUser user, @RequestBody TransmitBean transmitBean) {
        AppBean app=new AppBean();
        //app.setMark("water_02");
        // todo
        app.setMark(user.getCurrDs());
        log.info("传阅功能:currDs={}",user.getCurrDs());
        ThreadLocalContext.setApp(app);
        transmitBean.setAccount(user.getAccount());
        transmitBean.setName(user.getName());
        return ADOConnection.runTask(user.getCurrDs(),service,"transmit",Response.class,transmitBean);
    }
}
